<template>
  <div>
    <!-- tab切换表单 -->
    <div>
      <tab-helper :paneList="paneList">

        <!-- 组织基本信息 -->
        <div slot="1" class="newControlPlan-content">
          <div class="newControlPlan-content-card">
            <normal-form-plus
              :formModel="formModels.pane2.formModel"
              :config="formModels.pane2.config"
              :plus="formModels.pane2.plus"/>
            <el-button @click="save(1)" class="center-btn">保存</el-button>
          </div>
        </div>

        <!-- 主营产品/服务 -->
        <div slot="2" class="newControlPlan-content">
          <div class="newControlPlan-content-card">
            <el-button @click="add" class="add-btn">新增</el-button>
            <normal-table
              :tableData="formModels.pane3.tableData"
              :paginationConfig="formModels.pane3.paginationConfig"
              :tableLabel="formModels.pane3.tableLabel"
              :operationConfig="formModels.pane3.operationConfig"
              :operationList="formModels.pane3.operationList"
              @event="handleEvent"
              @changePage="changePage"></normal-table>

          </div>
          <el-dialog
            title="新增(编辑)主营产品/服务"
            :visible.sync="formModels.pane3.showWindow"
            width="40%"
            class="form">
            <!-- form表单 -->
            <div class="formData">
              <normal-form
                :formModel="formModels.pane3.addFormModel"
                :config="formModels.pane3.addConfig"
                :plus="formModels.pane3.addPlus"/>
            </div>
            <span slot="footer" class="form-footer">
                    <el-button type="primary" @click="addService()" class="confirm">确 定</el-button>
                    <el-button @click="makeSure">取 消</el-button>
                    </span>
          </el-dialog>
        </div>

        <!-- 组织边界 -->
        <div slot="3" class="newControlPlan-content">
          <div class="newControlPlan-content-card">
            <normal-form-plus
              :formModel="formModels.pane4.formModel"
              :config="formModels.pane4.config"
              :plus="formModels.pane4.plus"/>
            <el-button @click="save(2)">保存</el-button>
          </div>
        </div>


        <!-- 数据管理计划 -->
        <div slot="4" class="newControlPlan-content">
          <el-select class="newControlPlan-content-table" v-model="formModels.pane5.type" placeholder="请选择"
                     @change="changeType()">
            <el-option label="GHG" value="GHG"></el-option>
            <el-option label="ISO" value="ISO"></el-option>
          </el-select>
          <normal-table
            class="newControlPlan-content-table"
            :tableData="formModels.pane5.tableData"
            :paginationConfig="formModels.pane5.paginationConfig"
            :tableLabel="formModels.pane5.tableLabel"
            :operationConfig="formModels.pane5.operationConfig"
            :operationList="formModels.pane5.operationList"
            @event="handleEvent1"
            @changePage="changePage"></normal-table>

          <!-- 编辑因子 -->
          <el-dialog
            title="因子管理"
            :visible.sync="formModels.pane5.showWindow"
            width="60%"
            class="form">
            <!-- form表单 -->
            <div class="formData">
              <normal-form
                :formModel="formModels.pane5.addFormModel"
                :config="formModels.pane5.addConfig"
                :plus="formModels.pane5.plus"/>
            </div>
            <span slot="footer" class="form-footer">
                    <el-button type="primary" @click="createDataManage()" class="confirm">确 定</el-button>
                    <el-button @click="formModels.pane5.showWindow = false">取 消</el-button>
                    </span>
          </el-dialog>
        </div>

        <!-- 数据质量规定 -->
        <div slot="5" class="newControlPlan-content">
          <div class="newControlPlan-content-card">
            <normal-form-plus
              :formModel="formModels.pane6.formModel"
              :config="formModels.pane6.config"
              :plus="formModels.pane6.plus"/>
            <el-button @click="save(3)">保存</el-button>
          </div>
        </div>
      </tab-helper>
    </div>
  </div>
</template>

<script>
import TabHelper from '@/components/TabHelper'
import NormalForm from '@/components/NormalForm'
import NormalTable from '@/components/NormalTable'
import NormalFormPlus from '@/components/NormalFormPlus'
import {getDataManage, getDataManageList, updateDataManage} from '@/api/enterprise'

export default {
  components: {
    TabHelper,
    NormalForm,
    NormalFormPlus,
    NormalTable
  },
  mounted() {
    this.id = this.$route.query.id
    this.initData()
  },
  data() {
    return {
      id: '', // 对应控制计划的主id
      organizationId: '', // 组织id，用来标识是否已经有数据
      boundaryId: '', // 边界id
      accountBoundaryId: '', // 核算边界ID
      getDataManageStatus: '', // 数据管理计划状态
      dataManageId: '', // 数据管理ID
      addStatus: 0,
      // 表单主体
      formModels: {
        pane2: {
          formModel: {
            name: "", // 组织名称
            bizAddr: "", // 生产经营地址-所属地区
            bizAddrDetail: "", // 生产经营地址-详细地址
            carbonDept: "", // 碳盘查负责部门
            diagramDesc: "", // 组织平面图示意图描述
            diagramUrl: "", // 组织平面示意图
            groupDesc: "", // 温室气体管理小组架构描述
            groupUrl: "", // 温室气体管理小组架构
            industry: "钢铁行业", // 行业
            profile: "", // 企业简介
            registeredAddr: "", // 注册地址-所属地区
            registeredAddrDetail: "" // 注册地址-详细地址

          },
          config: [
            {
              id: 1,
              items: [
                {
                  id: '1',
                  edit: false,
                  type: 'input',
                  span: 6,
                  model: 'name',
                  name: '组织名称',
                  width: 40,
                  props: {
                    placeholder: "组织名称",
                    width: 200,
                  }
                },
                {
                  id: '2',
                  edit: false,
                  type: 'select',
                  span: 8,
                  model: 'industry',
                  name: '所属行业',
                  width: 150,
                  props: {
                    placeholder: "所属行业",
                    width: 200
                  }
                },
                {
                  id: '3',
                  edit: true,
                  type: 'input',
                  span: 8,
                  model: 'carbonDept',
                  name: '碳盘查负责部门',
                  width: 60,
                  props: {
                    placeholder: "碳盘查负责部门",
                    width: 200,

                  }
                },
              ]
            },
            {
              id: 2,
              items: [
                {
                  id: '1',
                  edit: true,
                  type: 'input',
                  span: 7.1,
                  model: 'registeredAddr',
                  name: '注册地址-所属地区',
                  width: 140,
                  props: {
                    placeholder: "注册地址-所属地区",
                    width: 200,
                  }
                },
                {
                  id: '2',
                  edit: true,
                  type: 'input',
                  span: 8,
                  model: 'registeredAddrDetail',
                  name: '注册地址-详细地址',
                  width: 200,
                  props: {
                    placeholder: "注册地址-详细地址",
                    width: 400
                  }
                },

              ]
            },
            {
              id: 3,
              items: [
                {
                  id: '1',
                  edit: true,
                  type: 'input',
                  span: 8,
                  model: 'bizAddr',
                  name: '生产经营地址-地区',
                  width: 140,
                  props: {
                    placeholder: "生产经营地址-所属地区",
                    width: 200,
                  }
                },
                {
                  id: '2',
                  edit: true,
                  type: 'input',
                  span: 8,
                  model: 'bizAddrDetail',
                  name: '生产经营地址-详细地址',
                  width: 200,
                  props: {
                    placeholder: "生产经营地址-详细地址",
                    width: 400
                  }
                },

              ]
            },
            {
              id: 4,
              items: [
                {
                  id: '1',
                  edit: true,
                  type: 'text',
                  span: 20,
                  model: 'profile',
                  name: '企业介绍',
                  width: 100,
                  props: {
                    placeholder: "企业介绍",
                    width: 150,
                    rows: 5
                  }
                },
              ]
            },
            {
              id: 5,
              items: [
                {
                  id: '1',
                  edit: true,
                  type: 'img',
                  span: 20,
                  model: 'modelLevel',
                  name: '组织平面示意图',
                  width: 100,
                  props: {
                    placeholder: "企业介绍",
                    width: 150,
                  }
                },
              ]
            },
            {
              id: 6,
              items: [
                {
                  id: '1',
                  edit: true,
                  type: 'text',
                  span: 20,
                  model: 'diagramDesc',
                  name: '组织平面示意图描述',
                  width: 100,
                  props: {
                    placeholder: "组织平面示意图描述",
                    width: 150,
                    rows: 5
                  }
                },
              ]
            },
            //  {
            //     id:7,
            //     items:[
            //         {
            //             id:'1',
            //             edit:true,
            //             type:'img',
            //             span:20,
            //             model:'modelLevel',
            //             name:'温室气体管理小组架构（最多5张）',
            //             width:200,
            //             props:{
            //                 placeholder:"企业介绍",
            //                 width:150,
            //             }
            //         },
            //     ]
            // },
            // {
            //     id:8,
            //     items:[
            //         {
            //             id:'1',
            //             edit:true,
            //             type:'text',
            //             span:20,
            //             model:'groupDesc',
            //             name:'温室气体管理小组架构描述',
            //             width:200,
            //             props:{
            //                 placeholder:"温室气体管理小组架构描述",
            //                 width:150,
            //             }
            //         },
            //     ]
            // },
          ],
          plus: {}
        },
        pane3: {
          plus: {},
          tableData: [],
          paginationConfig: {
            total: 100,
            page: 1,
            pageSize: 10,
            show: true
          },
          operationList: [
            {
              name: '编辑',
              order: 1,
              buttonClass: 'primary',
              plus: {}
            },
            {
              name: '删除',
              order: 2,
              buttonClass: 'danger',
              plus: {}
            }
          ],
          operationConfig: {select: false},
          tableLabel: [
            {
              prop: "order",
              label: "序号",
              width: 70
            },
            {
              prop: "service",
              label: "主营产品/服务名称",
              width: 200
            },
            {
              prop: "unit",
              label: "主营产品/服务单位",
              width: 150,
              codeTable: {
                '0': 't',
                '1': 'kg'
              }
            },
            {
              prop: "serviceDesc",
              label: "主营产品/服务描述",
              width: 600
            },
          ],
          showWindow: false,
          addPlus: {
            position: 'top'
          },
          addConfig: [
            {
              id: '1',
              type: 'input',
              model: 'service',
              name: '主营产品/服务名称',
              edit: true,
              width: 200,
              props: {
                placeholder: '主营产品/服务名称',
              }
            },
            {
              id: '2',
              type: 'select',
              model: 'unit',
              name: '主营产品/服务单位',
              edit: true,
              props: {
                placeholder: '主营产品/服务单位',
                options: [
                  {value: '0', label: 't'},
                  {value: '1', label: 'kg'}
                ]
              }
            },
            {
              id: '3',
              type: 'text',
              model: 'serviceDesc',
              name: '主营产品/服务描述',
              edit: true,
              props: {
                placeholder: '主营产品/服务描述',
              }
            },
          ],
          addFormModel: {
            serviceDesc: "",
            service: "",
            unit: 0
          },

        },
        pane4: {
          plus: {},
          formModel: {
            changeDesc: "",
            boundaryDesc: "",
            method: '股份比例法',
          },
          config: [
            {
              id: 1,
              items: [
                {
                  id: '1',
                  edit: true,
                  type: 'select',
                  span: 8,
                  model: 'method',
                  name: '组织边界设定方法',
                  width: 60,
                  props: {
                    placeholder: "组织边界设定方法",
                    width: 200,
                    options: [
                      {value: '0', label: '股份比例法'},
                      {value: '1', label: '财务控制权'},
                      {value: '2', label: '运营控制权'},
                    ]
                  }
                },
              ]
            },
            {
              id: 2,
              items: [
                {
                  id: '1',
                  edit: true,
                  type: 'text',
                  span: 16,
                  model: 'boundaryDesc',
                  name: '组织边界描述',
                  width: 120,
                  props: {
                    placeholder: "组织边界设定方法",
                    width: 200,
                    rows: 5
                  }
                },
              ]
            },
            {
              id: 3,
              items: [
                {
                  id: '1',
                  edit: true,
                  type: 'text',
                  span: 16,
                  model: 'changeDesc',
                  name: '组织边界变动说明',
                  width: 120,
                  props: {
                    placeholder: "组织边界变动说明",
                    width: 200,
                    rows: 5
                  }
                },
              ]
            },
          ],
        },
        pane5: {
          type: 'GHG', // 管理数据模式
          showWindow: false,
          addConfig: [
            {
              id: '1',
              type: 'select',
              model: 'classification',
              name: '排放分类',
              edit: false,
              props: {
                placeholder: '排放分类',
                options: []
              }
            },
            {
              id: '2',
              type: 'select',
              model: 'category',
              name: '排放类别',
              edit: false,
              props: {
                placeholder: '排放类别',
                options: []
              }
            },
            {
              id: '3',
              type: 'text',
              model: 'categoryDesc',
              name: '类别描述',
              edit: false,
              props: {
                placeholder: '类别描述',
              },
            },
            {
              id: '4',
              type: 'select',
              model: 'includeAccount',
              name: '是否纳入碳核算',
              edit: true,
              props: {
                placeholder: '是否纳入碳核算',
                options: [
                  {value: '0', label: '否'},
                  {value: '1', label: '是'},
                ]
              }
            },
            {
              id: '5',
              type: 'text',
              model: 'dataDesc',
              name: '活动描述/被排除的说明',
              edit: true,
              props: {
                placeholder: '活动描述/被排除的说明',
              },
            },
            {
              id: '6',
              type: 'text',
              model: 'collectionDesc',
              name: '数据收集说明',
              edit: true,
              props: {
                placeholder: '数据收集说明',
              },
            },
            {
              id: '7',
              type: 'select',
              model: 'accountMethod',
              name: '计算方法',
              edit: true,
              props: {
                placeholder: '计算方法',
                options: [
                  {value: '0', label: '排放因子法'},
                  {value: '1', label: '物料平衡法'},
                ]
              }
            },
            {
              id: '8',
              type: 'text',
              model: 'accountDesc',
              name: '计算方法描述',
              edit: true,
              props: {
                placeholder: '计算方法描述',
              },
            },
            {
              id: '9',
              type: 'text',
              model: 'storageDesc',
              name: '数据存储说明',
              edit: true,
              props: {
                placeholder: '数据存储说明',
              },
            },
          ],
          addFormModel: {
            accountBoundaryId: '',//	核算边界ID
            accountDesc: '',//	计算方法描述
            accountMethod: '',//	计算方法
            collectionDesc: '',//	数据收集说明
            dataDesc: '',//	活动描述/被排除的说明
            includeAccount: '',//	是否纳入碳排放核算
            planId: '',//	控制计划ID
            storageDesc: ''//	数据存储说明
          },
          formModel: {
            selection1: '',
            selection2: '',
            selection3: '',
          },
          config: [
            {
              id: 1,
              items: [
                {
                  id: '1',
                  edit: true,
                  type: 'input',
                  span: 4,
                  model: 'modelLevel',
                  name: '',
                  props: {
                    placeholder: "模型名称",
                    width: 150
                  }
                },
              ]
            },
          ],
          plus: {},
          tableData: [],
          paginationConfig: {
            total: 100,
            page: 1,
            pageSize: 10,
            show: true
          },
          operationList: [
            {
              name: '编辑',
              order: 1,
              buttonClass: 'primary',
              plus: {}
            }
          ],
          operationConfig: {select: false},
          tableLabel: [
            {
              prop: "category",
              label: "排放类别",
              width: 200
            },
            {
              prop: "categoryDesc",
              label: "类别说明",
              width: 200

            },
            {
              prop: "classification",
              label: "排放分类",
              width: 300
            },
            {
              prop: "dataDesc",
              label: "活动描述/被排除的说明",
              width: 400

            },
          ],
        },
        pane6: {
          plus: {},
          formModel: {},
          config: [
            {
              id: 1,
              items: [
                {
                  id: '1',
                  edit: true,
                  type: 'text',
                  span: 16,
                  model: 'dataQuality',
                  name: '数据质量管理规定',
                  width: 120,
                  props: {
                    placeholder: "数据质量管理规定",
                    width: 200,
                    rows: 5
                  }
                },
              ]
            },
          ],
        }
      },
      // tab栏配置
      paneList: [
        {
          id: '1',
          label: '组织基本信息'
        },
        {
          id: '2',
          label: '主营产品/服务'
        },
        {
          id: '3',
          label: '组织边界'
        },
        {
          id: '4',
          label: '运营边界'
        },
        {
          id: '5',
          label: '数据质量管理规定'
        },
      ],
    }
  },
  methods: {
    // 初始化所有的表单数据
    initData() {
      this.getOrganization()
      this.getBoundary()
      this.getServiceListByPage()
      this.getControlPlan()
      this.getDataManageList()
    },
    // 获取组织基本信息
    getOrganization() {
      if (this.$MOCK.mock) {
        this.organizationId = this.$MOCK.enterprise.controlPlanBaseInfo.data.id
        this.formModels.pane2.formModel = this.$MOCK.enterprise.controlPlanBaseInfo.data
        return
      }
      this.$API.enterprise.getOrganization({planId: this.id}).then(response => {
        if (response.data.id) {
          this.organizationId = response.data.id
          this.formModels.pane2.formModel = response.data
        }
      })
    },
    // 获得组织边界
    getBoundary() {
      if (this.$MOCK.mock) {
        this.boundaryId = this.$MOCK.enterprise.controlPlanBoundary.data.id
        this.formModels.pane4.formModel = this.$MOCK.enterprise.controlPlanBoundary.data
        const mapper = {
          0: '股份比例法',
          1: '财务控制权',
          2: '运营控制权',
        }
        this.formModels.pane4.formModel.method = mapper[this.formModels.pane4.formModel.method]
        return
      }
      this.$API.enterprise.getBoundary({planId: this.id}).then(response => {
        this.boundaryId = response.data.id
        this.formModels.pane4.formModel = response.data
        const mapper = {
          0: '股份比例法',
          1: '财务控制权',
          2: '运营控制权',
        }
        this.formModels.pane4.formModel.method = mapper[this.formModels.pane4.formModel.method]
      })
    },
    // 获得主营产品或服务分页
    getServiceListByPage() {
      if (this.$MOCK.mock) {
        this.formModels.pane3.tableData = this.$MOCK.enterprise.controlPlanServerList.data.list
        this.formModels.pane3.paginationConfig.total = this.$MOCK.enterprise.controlPlanServerList.data.total
        return
      }
      this.$API.enterprise.getServiceListByPage({
        pageNo: this.formModels.pane3.paginationConfig.page,
        pageSize: this.formModels.pane3.paginationConfig.pageSize,
        planId: this.id,
      }).then(response => {
        this.formModels.pane3.tableData = response.data.list
        this.formModels.pane3.paginationConfig.total = response.data.total
      })
    },
    // 创建主营产品或服务
    createService() {
      this.$API.enterprise.createService({
        ...this.formModels.pane3.addFormModel,
        planId: this.id
      }).then(response => {
        this.getServiceListByPage()
      })
    },
    // 删除主营产品或服务
    deleteService(id) {
      this.$API.enterprise.deleteService({
        id: id
      }).then(response => {
        this.getServiceListByPage()
      })
    },
    // 更新主营产品或服务
    updateService() {
      this.$API.enterprise.updateService({
        ...this.formModels.pane3.addFormModel,
        planId: this.id
      }).then(response => {
        this.getServiceListByPage()
      })
    },
    // 获得数据质量规定
    getControlPlan() {
      if (this.$MOCK.mock) {
        this.formModels.pane6.formModel = this.$MOCK.enterprise.controlPlan.data
        return
      }
      this.$API.enterprise.getControlPlan({id: this.id}).then(response => {
        // console.log(response)
        this.formModels.pane6.formModel = response.data
      })
    },
    // 更新数据质量规定
    updateDataControlPlan() {
      this.$API.enterprise.updateDataControlPlan({
        ...this.formModels.pane6.formModel,
        id: this.id
      }).then(response => {

      })
    },
    // 保存表单数据
    save(num) {
      this.$message({
        message: '保存成功',
        type: 'success'
      });
      // this.$router.push("/enterpriseCarbonAccounting/ControlPlan/data-manage")
      // return
      if (num == 1) {
        if (this.organizationId == '') {
          // 保存组织基本信息
          this.$API.enterprise.createOrganization({
            ...this.formModels.pane2.formModel,
            planId: this.id
          }).then(response => {

          })
        } else {
          // 更新组织基本信息
          this.$API.enterprise.updateOrganization({
            ...this.formModels.pane2.formModel,
            id: this.organizationId
          }).then(response => {

          })
        }
      } else if (num == 2) {
        if (this.boundaryId == '') {
          // 保存组织边界
          this.$API.enterprise.createBoundary({
            ...this.formModels.pane4.formModel,
            planId: this.id
          }).then(response => {

          })

        } else {
          // 更新组织边界
          this.$API.enterprise.updateBoundary({
            ...this.formModels.pane4.formModel,
            id: this.boundaryId
          }).then(response => {

          })

        }
      } else if (num == 3) {
        this.updateDataControlPlan()
      }
    },
    // 改变获取数据管理计划模式
    changeType() {
      this.getDataManageList()
    },
    // 获得数据管理计划列表
    getDataManageList() {
      if (this.$MOCK.mock) {
        this.formModels.pane5.tableData = this.$MOCK.enterprise.controlPlanDataManage.data
        return
      }
      this.$API.enterprise.getDataManageList({
        standard: this.formModels.pane5.type,
        planId: this.id,
      }).then(response => {
        this.formModels.pane5.tableData = response.data
      })
    },
    // 获得数据管理计划
    getDataManage(dataManageId) {
      this.$API.enterprise.getDataManage({
        id: dataManageId
      }).then(response => {
        const temDict = {
          0: '否',
          1: "是"
        }
        const temDict2 = {
          0: '排放因子法',
          1: "物料平衡法"
        }
        this.formModels.pane5.addFormModel.storageDesc = response.data.storageDesc
        this.formModels.pane5.addFormModel.includeAccount = temDict[response.data.includeAccount]
        this.formModels.pane5.addFormModel.dataDesc = response.data.dataDesc
        this.formModels.pane5.addFormModel.collectionDesc = response.data.collectionDesc
        this.formModels.pane5.addFormModel.accountMethod = temDict2[response.data.accountMethod]
        this.formModels.pane5.addFormModel.accountDesc = response.data.accountDesc
      })
    },
    // 处理数据管理、创建数据管理计划
    createDataManage() {
      this.formModels.pane5.showWindow = false;
      if (!this.getDataManageStatus) {
        // 更新数据管理计划
        this.$API.enterprise.updateDataManage({
          accountBoundaryId: this.formModels.pane5.addFormModel.accountBoundaryId,//	核算边界ID
          accountDesc: this.formModels.pane5.addFormModel.accountDesc,//	计算方法描述
          accountMethod: (this.formModels.pane5.addFormModel.accountMethod == "排放因子法") ? 0 : 1,//	计算方法
          collectionDesc: this.formModels.pane5.addFormModel.collectionDesc,//	数据收集说明
          dataDesc: this.formModels.pane5.addFormModel.dataDesc,//	活动描述/被排除的说明
          includeAccount: (this.formModels.pane5.addFormModel.includeAccount == "是") ? 1 : 0,//	是否纳入碳排放核算
          planId: this.formModels.pane5.addFormModel.planId,//	控制计划ID
          storageDesc: this.formModels.pane5.addFormModel.storageDesc,//	数据存储说明
          planId: this.id,
          id: this.dataManageId,
        }).then(response => {

        })
      } else {
        // 创建数据管理计划
        this.$API.enterprise.createDataManage({
          ...this.formModels.pane5.addFormModel,
          planId: this.id,
          accountBoundaryId: this.accountBoundaryId,
        }).then(response => {

        })
      }

    },
    handleEvent1(order, row) {
      console.log(row)
      this.formModels.pane5.addFormModel = {
        accountBoundaryId: '',//	核算边界ID
        accountDesc: '',//	计算方法描述
        accountMethod: '',//	计算方法
        collectionDesc: '',//	数据收集说明
        dataDesc: '',//	活动描述/被排除的说明
        includeAccount: '',//	是否纳入碳排放核算
        planId: '',//	控制计划ID
        storageDesc: ''//	数据存储说明
      }
      this.dataManageId = row.dataManageId
      this.accountBoundaryId = row.id
      this.formModels.pane5.showWindow = true;
      this.formModels.pane5.addFormModel.classification = row.classification
      this.formModels.pane5.addFormModel.category = row.category
      this.formModels.pane5.addFormModel.categoryDesc = row.categoryDesc
      if (row.dataManageId) {
        this.getDataManageStatus = 0;
        this.getDataManage(row.dataManageId)
      } else {
        this.getDataManageStatus = 1;
      }
    },
    handleEvent(order, row) {
      if (order == 1) {
        // 编辑主营产品
        this.formModels.pane3.showWindow = true
        this.formModels.pane3.addFormModel = JSON.parse(JSON.stringify(row))
        this.addStatus = 1
      } else if (order == 2) {
        // 删除主营产品
        this.deleteService(row.id)

      }
    },
    changePage() {
      //this.getServiceListByPage()
    },
    add() {
      this.formModels.pane3.addFormModel = {
        serviceDesc: "",
        service: "",
        unit: ''
      }
      this.formModels.pane3.showWindow = true
    },
    // 添加主要服务
    addService() {
      this.formModels.pane3.showWindow = false
      if (this.addStatus == 0) {
        this.createService()
      } else {
        this.updateService()
        this.addStatus = 0
      }


    },
    makeSure() {
      this.formModels.pane3.showWindow = false
    }

  }
}
</script>

<style lang="less" scoped>
.add-btn {
  margin-left: -1200px;
}

.center-btn {
  margin: auto;
  text-align: center;
}

.newControlPlan-content {
  height: 100vh;
  width: 90vw;

  .newControlPlan-content-card {
    padding: 20px;
    margin: auto;
    text-align: center;
  }

  .newControlPlan-content-table {
    padding-left: 30px;

  }
}

</style>
